<template>
	<view class="loading-box" :style="loadingStyle">
		<!-- <view class="rotate" :style="icontStyle"></view> -->
		<up-loading-icon class="icon" :size="size" :color="color"></up-loading-icon>
		<slot></slot>
	</view>
</template>

<script>
	import {
		computed
	} from "vue"
	export default {
		data() {
			return {}
		},
		props: {
			size: {
				type: Number,
				default: 20
			},
			color: {
				type: String,
				default: "#3b82f6"
			},
			mask: {
				type: Boolean,
				default: true
			}
		},
		computed: {
			icontStyle() {
				return `font-size:${this.size}rpx`;
			},
			loadingStyle() {
				return this.mask ? "background: rgba(0, 0, 0, 0.3);" : "";
			}
		}
	}
</script>

<style lang="scss" scoped>
	.loading-box {
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		top: 0;
		z-index: 10000;
		display: flex;
		justify-content: center;
		align-items: center;

		.icon {
			margin-right: 10rpx;
		}
	}
</style>